perm filename NOTES[TEX,ALS]5 blob sn#608108 filedate 1981-08-21 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00018 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	Bugs fixed since 1-APR-1981
C00010 00003	TO DEBUG
C00012 00004	May 12 1981 ALS Hack to save PASCAL core image:
C00015 00005	Dump of program PTEXLD
C00017 00006	PASCAL TEX:
C00021 00007	Revised rules for preparing a new distribution set. August 1981.
C00025 00008	IAZ's original rules to PREPARE A NEW SET OF DISTRIBUTABLE PASCAL SOURCES:
C00028 00009	The TEX distribution log is maintained under <tex.distrib>tex.distrib
C00029 00010	Start of a do file for ptex.
C00030 00011	To run PTEX with DDT for debugging:
C00033 00012	To obtain sample of font characters
C00034 00013	To determine font characteristics
C00035 00014	TEXSEM.SAI[TEX,DEK] table of contents
C00038 00015	To remove old files from SCORE and to FTP to and from SCORE
C00040 00016	TO PTEX MANUAL.TEX[TEX,DEK]
C00041 00017	MEMORY WORDS
C00043 00018	Questions:  Typ '14 (insnode) uses the tip field to say whether the
C00045 ENDMK
C⊗;
Bugs fixed since 1-APR-1981
∂05-Apr-81  1935	DEK  
To:   DRF at SU-AI, IAZ at SU-AI, zippel at MIT-MC,
      ramshaw at PARC-MAXC, scherlis at CMU-10A   
OK gang, here is really the last change until 1990:
TEXSEM.SAI page 15 line 359 (a typo introduced a few weeks ago)
WRONG:			begin shiftup←shiftup+delta; shiftdown←shiftdown+delta;
RIGHT:			begin shiftup←shiftup+delta; shiftdown←shiftdown-delta;

[DONE]

∂18-Apr-81  1214	DEK  
To:   DRF at SU-AI, IAZ at SU-AI, MFP at SU-AI,
      ramshaw at PARC-MAXC, zippel at MIT-MC, scherlis at CMU-10A    
While looking at the SAIL code today I noticed a bug that has never been
tweaked in three years of TEX usage: Suppose one says
	\leaders\hrule height 1pt depth 1pt \vfill
for example, in vertical mode, or
	\leaders\vrule width 3pt \hfill
in horizontal mode. The manual is a bit vague, but if taken literally it
says that these height and depth and width specs are redundant. The code,
however, first tries to take account of them and then erroneously tries
to output the rule as if it were a box! 

The following lines of code correct the bug, I think; I haven't bothered
to compile a new TEX with this fix, since nobody seems to mind the
existing version.

**** File 1) TEXDVI.OLD[TEX,DEK]/6P/46L
1)		if type(b) NEQ rulenode or 
1)		   (height(b)>-100000.0 and depth(b)>-100000.0) then
1)			begin hh←height(b)+depth(b); if hh<0 then hh←0;
**** File 2) TEXDVI.SAI[TEX,DEK]/6P/46L
2)		if type(b) NEQ rulenode then
2)			begin hh←height(b)+depth(b); if hh<0 then hh←0;
***************
[DONE]

**** File 1) TEXDVI.OLD[TEX,DEK]/6P/132L
1)		ww←width(b); if (ww<0) and (type(b) NEQ rulenode) then ww←0;
1)		if ww NEQ 0 and type(link(q))=gluenode then
**** File 2) TEXDVI.SAI[TEX,DEK]/6P/131L
2)		if type(b) NEQ rulenode then
2)			begin ww←width(b); if ww<0 then ww←0;
2)			end
2)		else ww←-1.0;
2)		if ww NEQ 0 and type(link(q))=gluenode then
***************
[DONE]

∂29-Apr-81  1409	DEK  
To:   ramshaw at PARC-MAXC, DRF at SU-AI, IAZ at SU-AI,
      scherlis at CMU-10A, zippel at MIT-MC, MFP at SU-AI    
A change to the line-breaking routine (saves memory and gives less weird
output in weird cases):
TEXSEM page 13 line 255
OLD:		else if badness=infty then continue;
NEW:		else if badness>threshold then continue;
[DONE]

6-may-81 In searching for bug with sub-subscripts, as reported by XXX, IAZ
and I found and fixed an error having to do with the assignment of widths
to math characters, where a reference to mathfonttable had been
inadvertently omitted.  This was fixed.

6-may-81
Working alone, I searched for similiar ommissions with respect to shifts
and I found and fixed two such locations, namely:
       In TEX.DOC       in TEX.PAS
    page 36 line 925        6136
	 36      950        6169
Sub-subscripts, sub-superscripts, super-superscripts, and super-subscripts now
seem to be positioned correctly.

6-May-81  16:08
mail for IAZ	Another bug found.
I made a thorough search as you suggested and found one other bug, to wit:

Line 1265 in TEX.DOC
was
    size:=maximum(1.8*h,2*h-xheight(fontsize[style])); {{ take care of large parenthesis }}
I changed it to
    size:=maximum(1.8*h,2*h-xheight(mathfonttable(fontsize[style]
			   +mathsy))); {{ take care of large parenthesis }}

Line 1265 in TEX.PAS
was
SIZE:=MAXIMUM(1.8*H,2*H-FMEM[PARBASE[FONTSIZE[STYLE]]+4].PTS);
I changed it to
SIZE:=MAXIMUM(1.8*H,2*H-FMEM[PARBASE[EQTB[FONTSIZE[STYLE]+2+1393].INT]+4].PTS);

A comparison line shows that this change is probably correct.
T:=FMEM[PARBASE[EQTB[FONTSIZE[STYLE]+2+1393].INT]+21].PTS;

May 18th
At DEK's suggestion, the postemble code that lists selected fonts now lists
only those fonts that are actually used.  This is done by having an array
FONTSUSED that is initiallized to zero and the appropiate entry is set to
one every time that a character is sent to the DVI file.  At postemble
time this array is then referenced and used to select fonts that are to be
listed.  Fonts declared but not used are, of course, referenced by PTEX
but DVIPRE and the printer are not bothered by their presence.  This
will relieve the DOVER, in particular, of the necessity of wasting memory
space on unused fonts.
TO DEBUG

1) Change the switches in TEX to read:

(*$R80,s8000,x11,T+,G+,D+,O-,Y+*)
(*$R80,s8000,x11,T+,G+,D+,O-,Y+*)	(*taken from running version*)

2) Change the switches in SYSDEP to read:

(*$R75,s8000,x11,T+,E+,G+,D+,O-,Y+*)

3) Change line circa 28 in SYSDEP to read:

CONST TERDEVICE='TER   ';

4)( Recompile both:

5) ASSIGN another tty:

First obtain a TTY # by typing <ESC><CALL> then PT<CR> to learn # then
<BREAK>R to return to your normal channel.

Then type:

ASS TTY # TER<CR>

6) LOAD tex,sysdep
	
   c 200

   st

7) On receiving a $ prompt type STOP #<cr> then END<cr>.

You will talk to the debugger on the regular channel and to TEX on the
assiged channel.

8) Use care not to type debugger or system commands on the assigned channel,
it will hopelessly confuse TEX, if you do.
 
8)  For a complete TEX trace introduce:

\trace←'77777777
May 12 1981 ALS Hack to save PASCAL core image:

To produce a new dump file for PTEX with preloaded tables:

1) Change switches in SYSDEP to:

(*$R75,s8000,x11,T-,E+,G+,D-,O-,Y+*)

2) Fix TEX.PAS as follows:

a) Change switches to:

(*$R80,s8000,x11,T-,G+,D-,O-,Y+*)

b) Add new var circa 2p 299l
	initializing: integer;

c) Introduce some new code starting at line circa 12p 586l,
	
where lower case lines are insertions and uppercase shows existing code.

BEGIN;
INITMEM;
INITTABLES;
    initializing:=65;
    writeln(tty,'Hit <call> key, then type REENTER<cr>'); break(tty);
    while initializing=65 do begin end;
    (*Extra instructions are needed to allow for variations in call point*)
    pausingonerrors:=true;
    pausingonerrors:=true;
    pausingonerrors:=true;
    pausingonerrors:=true;
    pausingonerrors:=true;
PAUSINGONERRORS:=TRUE;
*********

3) Now do the following:

Compile tex.pas and sysdep.pas separately.

Load ptexld[tex,sys],tex,sysdep
C 200
ST
Program will type:
	TO CONTINUE, HIT THE RETURN KEY *
Do it!

After a delay, program will type: 
	HIT <CALL> KEY, THEN TYPE REENTER<CR>
Do it!

Program will type:
	Now type SS PTEX.DMP<cr> to save the core image.
	Halt at user 171
Ignore the Halt message and
Do it!
The program is saved!

To test PTEX without saving it, type ST<CR>

The program will type:

	*

You are on your own!
***********
A transcript of an actual session follows:

.load pretex,tex,sysdep
Swapping to SYS:LOADER.DMP
LOADING

LOADER 182+62 PAGES

Exit
↑C
.c 200

.st


TO CONTINUE, HIT THE RETURN KEY *
HIT <CALL> KEY, THEN TYPE REENTER<CR>
↑C
↑C

.reenter

Now type SS PTEX.DMP<cr> to save the core image.
Halt at user 171
↑C
.ss ptex
Job saved in 200+62 pages
↑C
.ru ptex


*
Dump of program PTEXLD

124/	0 160					;The reentry address
				LOC 124
				START
				RELOC
			DCHKAC: BLOCK 20
160/	202740 157	START:	MOVEM 17,DCHKAC+17	;Save registers
161/	201740 140		MOVEI 17,DCHKAC
162/	251740 156		BLT 17,DCHKAC+16
163/	550740 130		HRRZ 17,130	;Get old restart address
164/	271740 4		ADDI 17,4	;To get out of loop
165/	542740 175		HRRM 17,NEWST2	;Continuing address
166/	201740 172		MOVEI 17,NEWST	;New starting address 
167/	542740 120		HRRM 17,120	;New starting address
170/	51140 202		OUTSTR [ASCIZ/Now type ...etc/]
171/	254200 171		HALT.
172/	51140 176	NEWST:	OUTSTR [ASCIZ/This is ....etc/]
173/	205740 157		MOVSI 17,DCHKAC+17	;Restore registers
174/	251740 17		BLT 17,17
175/	254000 175	NEWST2:	JRST .		;Address set by 165 above
176/	523215 171500		ASCIZ /This is PTEX./
177/	647464 50250	
200/	426605 606424	
201/	0 0	
202/	473376 720350		ASCIZ /Now type SS PTEX.DMP<cr>
					        to save the core image./
203/	747414 520246	
204/	515012 52212	
205/	541350 446640	
206/	363076 237100	
207/	723364 71702	
210/	733124 72320	
211/	625014 367744	
212/	625015 166702	
213/	637125 606424	
214/	0 0	.
				END
PASCAL TEX:
 
(May 9) The whole system consists of:
		
		TEX.PAS  the main program,
 
		TEXPRE.PAS the generator of TEXINI.TBL
 
		SYSDEP.PAS the system dependent routines
 
		TEXINI.TBL the table of initial contents of tables
 
		STRINI.TBL the list of strings printable by the current module

TEXPRE runs independently of TEX, but uses the same SYSDEP module. TEXPRE
accesses STRINI.TBL and expects to find its own error messages there. Thus
two different string tables should be maintained: one for TEXPRE and
another for TEX which should be given the name STRINI.TBL when needed.

(June 5) For IBM:

	- Check the LONG.LNS file to modify those lines of the source
	that exceed 72 characters.

(June 29) TEXDOC does not take the compiler directives:

In SYSDEP:
	(*$R75,s8000,x11,T+,E+,G+,D-,O-,Y+*) {{ Compiler directives for the
						 PDP-10 PASCAL compiler}}
The corresponding line in TEX.DOC: (first line of page 3)
	(*$R80,s8000,x11,T+,G+,D+,O-,Y-*) {{ Compiler options. }}
and in TEXPRE.DOC:
	(*$R80,s8000,x11,T+,G+,D-,O-,Y-*) {{ Compiler options }}

initializing:=65; 		     (* 65.='101 easy to recognize in DDT *)
if initializing<>0 then writeln(tty,'Save TEX'); break(tty); (* surprisingly
							 enough, this works *)
while initializing=65 do begin end;


As far as the laws of mathematics refer to reality they are not certain. 
As far as the laws of mathematics are certain they don't refer to reality.
 
Albert Einstein

EX FORMAT[TEX,IAZ] is used to make TEX.PAS all caps for distribution
R PFORM to pretty print. I prefer option to indent 2 instead of 3.
	read PFORM foor details
The codes that need fixing are TEX.PAS, TEXPRE.PAS, AND SYSDEP.PAS.
For export, the scheme is to run FORMAT then PFORM then FORMAT finally.

To prepare string table
COPY STRINI.TBL[TEX,SYS]←SYSDEP.STR,TEX.STR


UNDOC produces the PAS versions
TEXDOC produces the documention for TEXing

PTEXIN?

To remove old version from SCORE
TELNET SCORE<CR>
CSD.ZABALA<CR>
PINDONGA<CR>
DEL XXXXX.XXX<CR>
EXP<CR>
K<CR>
Revised rules for preparing a new distribution set. August 1981.

1) Run TEXDOC[TEX,IAZ] on TEX.DOC and TEXPRE.DOC and fix all 
	obvious errors that might affect the .PAS code.

2) Run UNDOC[TEX,IAZ] on 
     TEX.DOC, TEXPRE.DOC, and  SYSDEP.DOC
	with .STR files going to [TEX.SYS],
	initial string number at 128 for SYSDEP.STR 
	and at 132 for TEX.STR and TEXPRE.STR.
  and with the .PAS files probably on [TEX,ALS]

3) Ex FORMAT[TEX,IAZ] on the 3 .PAS files with output as .POS
   After each run check LONG.LNS and
   fix lengths of lines, remove tabs and fix formmatting errors
   An E macro αβ1αβXjf<cr><cr> can be use to break all long lines
   and to remove all leading tabs and spaces but it will be very slow
   and it obviously does not know PASCAL so it will not handle lines
   that do not have the necessary spaces available.

4) Now R PFORM on the three.POS files with outputs as .PAS
   Check the files for obvious format errors 

5) Remove all leading spaces and tabs with αβ∞αβXalign or
   use the E macro suggested above in 3

6) Make all upper case, perhaps with an E macro although this is very slow.
   FORMAT will do this but it puts in extra blank lines
   and generates some additional long lines that must be fixed by hand.

7) Copy STRINI.TBL[TEX,SYS]←SYSDEP.STR[TEX,SYS],TEXPRE.STR[TEX,SYS]

8) Insert compiler switches in the three .PAS files

9) Put the ALS (page 4) code into TEX.PAS for generating a preloaded PTEX file

10) Compile SYSDEP.PAS and compile TEXPRE.PAS separately

11) Load and Start TEXPRE,SYSDEP to generate PTEXIN.TBL

12) Compile TEX.PAS

13) Copy STRINI.TBL[TEX,SYS]←SYSDEP.STR[TEX,SYS),TEX.STR(TEX,SYS]

14) Load TEX,SYSDEP, C 200 and Start. Then follow instructions on screen.

15) Verify that PTEX works OK on several test files.

16) Delete compiler switches and special ALS code from .PAS files

17) Follow instructions on page 15 to FTP 6 files to SCORE.
IAZ's original rules to PREPARE A NEW SET OF DISTRIBUTABLE PASCAL SOURCES:
(The TEXDOC and UNDOC programs we talk about here are those in [tex,iaz])

-Take away the comments and compiler directives in page 2, line 1 of TEX.DOC:
(same for TEXPRE)


-Run TEXDOC on TEX.DOC to check errors

(* \TEX\ {\:c STANFORD CS FEB 1981.}
\TEX\ was designed by Donald E. Knuth, who initially implemented it in \&{SAIL}.
This \&{PASCAL} version of \TEX\ is due to Ignacio A. Zabala. *)
(*$R80,s8000,x11,T+,G+,D+,O-,Y-*)


-Take away the comments and compiler directives in SYSDEP.DOC page 2 line 9

(* \TEX\ {\:c STANFORD CS FEB 1981.}
\TEX\ was designed by Donald E. Knuth, who initially implemented it in \&{SAIL}.
This \&{PASCAL} version of \TEX\ is due to Ignacio A. Zabala. *)
(*$R75,s8000,x11,T+,E+,G+,D+,O-,Y-*)

(* TEX STANFORD CS FEB 1981.
TEX was designed by Donald E. Knuth,
who initially implemented it in SAIL.
This PASCAL version of TEX
is due to Ignacio A. Zabala. *)
(*$R75,s8000,x11,T-,E+,G-,D-,O-,Y+*)

-Run TEXDOC on SYSDEP to check errors

-Run UNDOC on SYSDEP (but put strings in SYSDEP.STR[tex,iaz] just in case
something fails).

-Run FORMAT on SYSDEP.PAS to get SYSDEP.POS

-Put comments and compiler directives back into SYSDEP

-Run PFORM on SYSDEP.POS

-Compile SYSDEP.






- At the end. After everything appears correct, the last step is to
run FORMAT and all three .pas files once more to get them in the right format,
and to run TEXDOC on them to obtain listings if desired.
The TEX distribution log is maintained under <tex.distrib>tex.distrib
Start of a do file for ptex.

access tex,iaz↔
TEX↔
FTP SCORE↔
ascii↔
user csd.zabala↔
pindonga↔
XCWD <TEX.PASCAL>↔
get tex.pas↔
get texpre.pas↔
get sysdep.pas↔
bye↔|

compile sysdep↔
compile texpre↔
load sysdep,texpre↔
c 200↔
st↔|

al TEX,SYS↔
COP STRINI.TBL←SYSDEP.STR,TEX.STR↔

compile sysdep,pas[tex,iaz]↔
compile tex,pas[tex,iaz]↔
load tex.sysdep↔
c 200↔

r tftopl↔
cmr10↔
er carm10.pl↔|

To run PTEX with DDT for debugging:

1) Change switches to read:
	in tex.pas
(*$R80,s8000,x11,T+,G+,D+,O-,Y+*)
	in sysdep.pas
(*$R75,s8000,x11,T+,E+,G+,D+,O-,Y+*)

2)  Delete special loading-hack instructions from TEX

3)  Change line at approx. 28 on p 1 in SYSDEP.PAS, now reading:
	CONST TERDEVICE='TTY   ';
to;
	CONST TERDEVICE='TER   ';

4)  Compile TEX.PAS and SYSDEP.PAS separately, for safety.

5)  Now get an extra channel
	type <ESC><CALL>,  then type pt and note number #
	type <BREAK> R	 to go back and quickly
	type ASSIGN TTY# TER<cr> using the number reported as #
	now debugger will report on original channel
	and new channel is used for commands to TEX
5)  Now type:
	load/ddt TEX,SYSDEP<cr>
    then
	c 200<cr>
    then
	st<cr>
The program should enter the PASCAL debugger and wait for a STOP command
and an end<cr>to start it running.

6)  Now go to the extra channel and wait for the * prompt from Tex and reply
with the necessary \input filename info.
type file name<cr>
stop ? set desired stop
end<cr>   tell program to run until stopped or to end
at stop type i<cr> then \chpar0←'77777777<cr>
at any stop location to read any cell number #, type #=<cr>
To read mem location type mem[#]twoword.byte2=
or mem[#].fourbyte.byte1=
or mem[#].pts

At end of session deassign the extra channel by typing DEA<cr> on the normal 
channel, then BREAK R to get to the assigned channel and then hit CALL.
To obtain sample of font characters
	R TEX
	\input sample.tex[can,ltp]
at stop type 
	i<cr>
then	cmathx {}<cr>  
or the name of some other font
	<cr>  to print.
To determine font characteristics
	R TFtoPL
	\input cmathx.mft
Creates a file CMATHX.PL   for example
TEXSEM.SAI[TEX,DEK] table of contents
COMMENT ⊗   VALID 00019 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00004 00002	entry begin comment The semantics module of TEX.
C00008 00003	Data structures for boxes.
C00027 00004	Displaying and destroying boxes: dumpnodelist,dsnodelist,tracedump,boxcopy
C00037 00005	The semantic stacks: mode,head,curnode,aux,spacefactor,prevdepth,incompleat
C00044 00006	The page builder.
C00054 00007	Introduction to math formula processing and data structures for mlists.
C00076 00008	Maintaining the semantic stacks: pushnest,popnest,decodemode,dumpactivities
C00080 00009	Font information. (New specifications due to Lyle Ramshaw, November 1980.)
C00116 00010	Making lists into boxes: nullbox,hpackage,vpackage,hpack,vpack
C00130 00011	Spacing and adding to the current list: initsftable,append,finishdisplay
C00141 00012	Hyphenation (word division) routines.
C00160 00013	The paragraph builder: hangwidth,hangbegin,justification,finishparagraph
C00201 00014	Procedures for mmode: finishmlist,boxchar,compact,mathglue,varsymbol,
C00218 00015	Major math mode procedures: mlist_to_hlist,evalmlist,boxfield
C00253 00016	Data structures for \halign and \valign: alignlist,alignrecord
C00260 00017	Alignment procedures: (init|end)align,(start|finish)(alignbox|unsetnode)
C00275 00018	Beginning of the main procedure: maincontrol
C00322 00019	Ending of the main procedure
C00348 ENDMK
C⊗;
To remove old files from SCORE and to FTP to and from SCORE

To transfer TEX.PAS  and SYSDEP.PAS from Score to SAIL.

FTP SCORE<cr>	To get into SCORE
ASCII<cr>	To specify the type of file
USER CSD.ZABALA<cr>	To use Zabala's account
PINDONGA<cr>
XCWD <TEX.PASCAL><cr>	Specifying the directory area
GET TEX.PAS<cr>
GET SYSDEP.PAS<cr>
etc.
BYE<cr>

To restore updated files at score one must first log in at score and
delete the old file to prevent the FTPed program from being added as a
second version.

To remove old files

TELNET SCORE<cr>
@ csd.zabala<cr>
@ type password
@ del TEX.PAS<cr>
@ del TEXPRE.PAS<cr>
@ etc.
@ EXP<cr>
@ K


To store new files use the above FTP routine replacing the GET by PUT.
TO PTEX MANUAL.TEX[TEX,DEK]

R PTEX<cr>
\input manual.tex[tex,dek]
<cr>	To ignore the non-standard warning line
i<cr>	To fix the non-found file request
manhdr.tex[tex,dek] {}<cr>

MEMORY WORDS
A memory word contains	|	      real		|
	or		|	     integer		|
	or		|     lnk	|      info	|
	or		|     lnk	|  tip	|  val	|
The first word of an empty node contains 
	lnk = link to next empty node	info = '177777 (65536)
the second word contains 
	lnk = llink to previous node	info = nodesize

The first word of each allocated node contains
	lnk = link	tip = typ	val = added information

Word2 normally contains |  llink  	|  typ	|  val	|

typ	cont.	length	word2		word3	word4	word5	word6	word7	
0	hlist	7	link		dpth	wdth	hgth	shift	6lue
1	vlist	7	link		dpth	wdth	hgth	shift	glue
2	rule	5	  -		dpth	wdth	hgth
3	whatsit 2	
4	glue	2	
5	leader  2	link
6	kern	2	 (neg) glue
7	hyph	2	  int
8	penalty	2	  int
9	disc	2	  breakchar
10	eject	2	  -	(val in first word = 0,1 or 2)
11	mark	2	link
12	ins	2	    depth	(pointer, 0 1 2, val = 0,1 )
13	unset	7	(same as hlist and vlist)
    IF ((P<25000) AND ((MEM[P].TWOHALVES.BYTE2<3) OR
			(MEM[P].TWOHALVES.BYTE2>12))) THEN 
Questions:  Typ '14 (insnode) uses the tip field to say whether the
insertion is in hmode, vmode or neither.  Therefore it contains no typ
value.  1) How is it identified for deletion?  2) What prevents it from
being handled wrongly by DSNODELIST?  3) When if ever is there a case 12 in

PROCEDURE DSNODELIST(P: INTEGER); (circa line 3445 in TEX.PAS) 
...  
CASE MEM[P].TWOHALVES.BYTE2 
OF 
...  
12: BEGIN DSNODELIST(MEM[L].TWOHALVES
	.LHWORD);
FREENODE(L,5);
FREENODE(P,2) END;

since byte2 is never set to 12 to mean INSMODE?

The statement in section 328 of TEX,DOC is clearly not the whole story because
byte2 IS set to 12 on many occasions, but then it is also used in the manner
here described.  The question is: Is FREENODE ever called when this is being
used to hold 0, 1 or 2 to indicate the type of insertion?